<?php
namespace app\common\command;

use app\api\model\TkRoom;
use app\api\model\TkUser;
use think\console\Command;
use think\console\Input;
use think\console\input\Argument;
use think\console\input\Option;
use think\console\Output;

class Test extends Command
{
    protected function configure()
    {
        $this->setName('hello')
            ->addArgument('name', Argument::OPTIONAL, "your name")
            ->addOption('city', null, Option::VALUE_REQUIRED, 'city name')
            ->setDescription('Say Hello');
    }

    protected function execute(Input $input, Output $output)
    {
//        $name = trim($input->getArgument('name'));
//        $name = $name ?: 'thinkphp';
//
//        if ($input->hasOption('city')) {
//            $city = PHP_EOL . 'From ' . $input->getOption('city');
//        } else {
//            $city = '';
//        }
//
//        $output->writeln("Hello," . $name . '!' . $city);

//        print_r(TkRoom::autoAddRobet());

        while (1){
            /*增加一个Ready的机器人*/
            TkUser::addRobot();

            sleep(random_int(3,5));
        }


        $output->writeln("Hello," );
    }
}